package com.test.vote.service;

import com.test.vote.mapper.UserDao;
import com.test.vote.pojo.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class helloService {

    @Resource
    UserDao userDao;

    //通过账号找到用户
    public boolean selectUserByAccount(User user) {
        if (userDao.selectUserByAccount(user) != null) {
            User user1 = userDao.selectUserByAccount(user);
            return true;
        }
        return false;
    }

    //用户登录
    public User userLogin(User user) {
        return userDao.userLogin(user);
    }

    //更新用户信息
    public int updateInfo(User user) {
        return userDao.updateByPrimaryKeySelective(user);
    }

    //通过Id找到用户
    public User userById(int userId) {
        return userDao.selectByPrimaryKey(userId);
    }

    //判断密码是否与原密码正确
    public User ifPsw(User user) {
        return userDao.ifPsw(user);
    }
}
